package com.lagou.model;

/**
 * 统一响应
 */
public class Response <T>{

    public static final Long OK = 200L;

    public static final Long BAD_REQUEST = 400L;

    /**
     * 状态码
     */
    private Long code;
    /**
     * 响应消息
     */
    private String message;
    /**
     * 消息负载
     */
    private T payload;

    public Response() {
        this(OK);
    }

    public Response(Long code) {
        this(code, null);
    }

    public Response(Long code, String message) {
        this(code, message, null);
    }

    public Response(Long code, String message, T payload) {
        this.code = code;
        this.message = message;
        this.payload = payload;
    }

    public Response(T payload) {
        this(OK, (String)null, payload);
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getPayload() {
        return payload;
    }

    public void setPayload(T payload) {
        this.payload = payload;
    }
}
